import http from '@/utils/http'

const BASE_URL = '/testing/reportDetailStress'

export interface ReportDetailStressResp {
  id: string
  reportId: string
  assertInfo: string
  errorCount: string
  errorPercentage: string
  maxTime: string
  meanTime: string
  minTime: string
  receiveKBPerSecond: string
  sentKBPerSecond: string
  requestLocation: string
  requestHeader: string
  requestBody: string
  requestRate: string
  responseCode: string
  responseData: string
  responseHeader: string
  samplerCount: string
  samplerLabel: string
  sampleTime: string
  version: string
  status: string
  isDeleted: string
  createdBy: string
  updatedBy: string
  createdAt: string
  updatedAt: string
  createUserString: string
  updateUserString: string
}
export interface ReportDetailStressDetailResp {
  id: string
  reportId: string
  assertInfo: string
  errorCount: string
  errorPercentage: string
  maxTime: string
  meanTime: string
  minTime: string
  receiveKBPerSecond: string
  sentKBPerSecond: string
  requestLocation: string
  requestHeader: string
  requestBody: string
  requestRate: string
  responseCode: string
  responseData: string
  responseHeader: string
  samplerCount: string
  samplerLabel: string
  sampleTime: string
  version: string
  status: string
  isDeleted: string
  createdBy: string
  updatedBy: string
  createdAt: string
  updatedAt: string
  createUserString: string
  updateUserString: string
}
export interface ReportDetailStressQuery {
  version: string
  createdBy: string
  sort: Array<string>
}
export interface ReportDetailStressPageQuery extends ReportDetailStressQuery, PageQuery {}

/** @desc 查询压力测试报告列表 */
export function listReportDetailStress(query: ReportDetailStressPageQuery) {
  return http.get<PageRes<ReportDetailStressResp[]>>(`${BASE_URL}`, query)
}

/** @desc 查询压力测试报告详情 */
export function getReportDetailStress(id: string) {
  return http.get<ReportDetailStressDetailResp>(`${BASE_URL}/${id}`)
}

/** @desc 新增压力测试报告 */
export function addReportDetailStress(data: any) {
  return http.post(`${BASE_URL}`, data)
}

/** @desc 修改压力测试报告 */
export function updateReportDetailStress(data: any, id: string) {
  return http.put(`${BASE_URL}/${id}`, data)
}

/** @desc 删除压力测试报告 */
export function deleteReportDetailStress(id: string) {
  return http.del(`${BASE_URL}/${id}`)
}

/** @desc 导出压力测试报告 */
export function exportReportDetailStress(query: ReportDetailStressQuery) {
  return http.download<any>(`${BASE_URL}/export`, query)
}
